import request from "@/utils/request";

/**
 * 一级分类类型
 */
export interface category1ItemType {
  id: number;
  name: string;
}
export type category1ListType = category1ItemType[];
/**
 * 二级分类类型
 */
export interface category2ItemType {
  id: number;
  name: string;
  category1Id: number;
}
export type category2ListType = category2ItemType[];
/**
 * 二级分类类型
 */
export interface category3ItemType {
  id: number;
  name: string;
  category2Id: number;
}
export type category3ListType = category3ItemType[];
/**
 * 请求一级分类列表
 * @returns
 */
export const reqCategory1Info = () => {
  return request.get<null, category1ListType>(`/admin/product/getCategory1`);
};
/**
 * 请求二级分类列表
 * @returns
 */
export const reqCategory2Info = (category1Id: number) => {
  return request.get<null, category2ListType>(
    `/admin/product/getCategory2/${category1Id}`
  );
};
/**
 * 请求三级分类列表
 * @returns
 */
export const reqCategory3Info = (category2Id: number) => {
  return request.get<null, category3ListType>(
    `/admin/product/getCategory3/${category2Id}`
  );
};
